import '../item_style.dart';
import '../line_style.dart';
import '../tooltip.dart';
import 'series.dart';

import 'package:json_annotation/json_annotation.dart';

part 'map_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class MapEmphasis {
  SeriesLabel? label;
  ItemStyle? itemStyle;

  MapEmphasis({this.itemStyle, this.label});

  factory MapEmphasis.fromJson(Map<String, dynamic> json) =>
      _$MapEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$MapEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class MapBlurSelectEmphasis {
  SeriesLabel? label;
  ItemStyle? itemStyle;
  LineStyle? lineStyle;

  MapBlurSelectEmphasis({this.itemStyle, this.label, this.lineStyle});

  factory MapBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$MapBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$MapBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class MapData {
  var name;
  var value;

  var selected;

  ItemStyle? itemStyle;
  SeriesLabel? label;
  LabelLine? labelLine;
  MapBlurSelectEmphasis? emphasis;
  MapBlurSelectEmphasis? select;
  Tooltip? tooltip;

  MapData(
      {this.name,
      this.value,
      this.label,
      this.labelLine,
      this.itemStyle,
      this.emphasis,
      this.tooltip});

  factory MapData.fromJson(Map<String, dynamic> json) =>
      _$MapDataFromJson(json);

  Map<String, dynamic> toJson() => _$MapDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class MapSeries extends Series {
  var type = 'map';
  var id;
  var name;
  var map;
  var roam;
  var center;
  var aspectScale;
  var boundingCoords;
  var zoom;
  var nameMap;
  var nameProperty;
  var selectedMode;
  SeriesLabel? label;
  ItemStyle? itemStyle;

  MapEmphasis? emphasis;
  MapBlurSelectEmphasis? select;

  var zlevel;
  var z;
  var left;
  var top;
  var right;
  var bottom;
  var layoutCenter;
  var layoutSize;

  var geoIndex;
  var mapValueCalculation;
  var showLegendSymbol;
  var seriesLayoutBy;
  var datasetIndex;

  LabelLayout? labelLayout;
  LabelLine? labelLine;
  List<MapData>? data;

  MarkPoint? markPoint;

  MarkLine? markLine;

  MarkArea? markArea;

  var silent;
  Tooltip? tooltip;

  MapSeries(
      {this.id,
      this.name,
      this.map,
      this.roam,
      this.center,
      this.aspectScale,
      this.boundingCoords,
      this.zoom,
      this.nameMap,
      this.nameProperty,
      this.selectedMode,
      this.label,
      this.itemStyle,
      this.emphasis,
      this.select,
      this.zlevel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.layoutCenter,
      this.layoutSize,
      this.geoIndex,
      this.mapValueCalculation,
      this.showLegendSymbol,
      this.seriesLayoutBy,
      this.datasetIndex,
      this.labelLayout,
      this.labelLine,
      this.data,
      this.markPoint,
      this.markLine,
      this.markArea,
      this.silent,
      this.tooltip});

  factory MapSeries.fromJson(Map<String, dynamic> json) =>
      _$MapSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$MapSeriesToJson(this);
}
